﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.ObjectModel;
using Highchart.Core.Data.Chart;
using Highchart.Core;

namespace Highchart.Web
{
    public partial class Sample08 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {            
                Exemplo08();
        }

        private void Exemplo08()
        {
            hcVendas.Appearance = new Core.Appearance.Appearance() { renderTo = "container", zoomType = "x" };
            //definições de eixos
            hcVendas.YAxis.Add(new YAxisItem { title = new Title("Faturamento"), type = AxisDataType.linear });
            hcVendas.XAxis.Add(new XAxisItem { maxZoom = 5, labels = (new Labels() { rotation = 45, step = 2 }) });

            var series = new SerieCollection();
            series.Add(new Serie { id = "Serie1", type = RenderType.areaspline, data = new object[] { 412, 711, 523, -147, 149, null, 222, 434, 43, 432, 115, 667 } });
            series.Add(new Serie { id = "Serie2", type = RenderType.spline, data = new object[] { 711, 523, 412, 434, 147, 122, 149, 222, 432, 667, 43, 115 } });
            
            // JSON Data Source
            hcVendas.AjaxDataSource = new AJAXSource("./AJAXtest.aspx", 5000, false, false, true); // (source, delay, clearAll, onlyOnce, shift)
            
            //bind do controle
            hcVendas.DataSource = series;
            hcVendas.DataBind();
            
        }

    }
}